]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
modal-dialog: Don't let buttons steal manually-set focus
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 15 Sep 2011 12:02:42 +0000 (14:02 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Sep 2011 19:26:32 +0000 (21:26 +0200)
ModalDialog provides a method to set the initial focus. However,
when adding buttons, the initial focus is always set to the last
button, thus overwriting a previously set manual focus.
Instead, only set the initial key focus if setInitialKeyFocus()
has not been called manually before.

https://bugzilla.gnome.org/show_bug.cgi?id=659133

js/ui/modalDialog.js

index 80615870c423c768ffd940bc7e646b8f1714db56..270423aaf60c5c8a07643e048957ff39206fd5e0 100644 (file)
@@ -131,7 +131,9 @@ ModalDialog.prototype = {
             else
                 x_alignment = St.Align.MIDDLE;
 
-            this._initialKeyFocus = buttonInfo.button;
+            if (this._initialKeyFocus == this._dialogLayout ||
+                this._buttonLayout.contains(this._initialKeyFocus))
+                this._initialKeyFocus = buttonInfo.button;
             this._buttonLayout.add(buttonInfo.button,
                                    { expand: true,
                                      x_fill: false,